namespace BB.Apostas.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class v1 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
               "dbo.Apostas",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
               })
               .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Competicaos",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Descricao = c.String(),
                })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Classificacaos",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Jogoes",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Jornadas",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Noticias",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Registoes",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Competicao_Id = c.Int(),
                    User_UserId = c.Int(),
                })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Competicaos", t => t.Competicao_Id)
                .ForeignKey("dbo.UserProfile", t => t.User_UserId)
                .Index(t => t.Competicao_Id)
                .Index(t => t.User_UserId);

            CreateTable(
                "dbo.Reportes",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    ReportType = c.String(),
                    Message = c.String(nullable: false),
                    State = c.String(),
                    CreatedDate = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id);

            AddColumn("dbo.UserProfile", "Email", c => c.String());
        }

        public override void Down()
        {
            DropIndex("dbo.Registoes", new[] { "User_UserId" });
            DropIndex("dbo.Registoes", new[] { "Competicao_Id" });
            DropForeignKey("dbo.Registoes", "User_UserId", "dbo.UserProfile");
            DropForeignKey("dbo.Registoes", "Competicao_Id", "dbo.Competicaos");
            DropTable("dbo.Reportes");         
            DropTable("dbo.Registoes");
            DropTable("dbo.Noticias");
            DropTable("dbo.Jornadas");
            DropTable("dbo.Jogoes");
            DropTable("dbo.Classificacaos");
            DropTable("dbo.Competicaos");
            DropTable("dbo.Apostas");            
            DropColumn("dbo.UserProfile", "Email");
        }
    }
}
